<!doctype html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

<div id="app">
    <h3>1：双大括号输出文本内容</h3>
    <!-- 直接获取文本的内容-->
    <p> {{message}}</p>
    <!-- 直接进行计算-->
    <p>{{score+1}}</p>

    <h3>2: 一次性插值，v-once</h3>
    <p v-once>{{score+1}}</p>

    <h3>
        3:指令输出真正的HTML内容
        可以防止xss攻击
    </h3>
    <p>双大括号:{{contentHtml}}</p>
    <p v-html="contentHtml"></p>
    <h3>
        4:v-bind 属性绑定指令
    </h3>
    <!-- v-bind 缩写-->
    <img :src="imageUrl"/>

    <h3>
        5:v-on 事件绑定指令
    </h3>
    <input type="text" v-model="num"/>
    <button @click="add">点击+1</button>
</div>

<script src="node_modules/vue/dist/vue.js"></script>
<script>
    new Vue({

        el: "#app",
        data: {
            message: "孟学过",
            score: 100,
            contentHtml: '<span style="color: red"> v-html 属性 此内容为红色字体</span>',
            imageUrl: 'https://cn.vuejs.org/images/logo.png',
            num: 10
        },
        methods: {
            add() {
                this.num++
            }
        }
    });
</script>
</body>
</html>
